Skip to content

Conversation

LucasCharrier
Copy link
Contributor

@LucasCharrier LucasCharrier commented Sep 8, 2025

No description provided.

@revu-bot revu-bot bot requested a review from revu-bot September 8, 2025 16:02
@LucasCharrier LucasCharrier marked this pull request as draft September 8, 2025 16:02
Copy link
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces a new status item design with significant refactoring of the CircledIcon component and a new NewStatusItem component. However, the implementation contains several critical issues including hardcoded placeholder data, missing React keys, potential memory leaks, and extensive commented-out code that suggests the feature is incomplete. The NewStatusItem component appears to contain debugging/placeholder code that shouldn't be in production.

Comment on lines 132 to 137
{[0, 1, 2, 3].map((item) => (
<View className="flex-1 flex-row items-center mb-2">
<View className="h-3 w-3 rounded-full mr-2 bg-red"></View>
<View>
<Text>Anxiété, Irritabilité</Text>
</View>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcoded text and the map over [0,1,2,3] appears to be placeholder/debug code. Hardcoded strings like 'Anxiété, Accablement, Contrariété, Jalousie,' should be replaced with dynamic data or at minimum moved to constants.

Suggested change
{[0, 1, 2, 3].map((item) => (
<View className="flex-1 flex-row items-center mb-2">
<View className="h-3 w-3 rounded-full mr-2 bg-red"></View>
<View>
<Text>Anxiété, Irritabilité</Text>
</View>
{patientStateRecordKeys.map((key) => {
let patientStateRecord = patientState[key];
if (!patientStateRecord || patientStateRecord?.value === null || patientStateRecord.value === undefined) {
return null;
}
const indicator = indicateurs.find((i) => i.genericUuid === key) || indicateurs.find((i) => i.uuid === key);
return (
<View key={key} className="flex-1 flex-row items-center mb-2">
<View className="h-3 w-3 rounded-full mr-2 bg-red"></View>
<View>
<Text>{indicator?.name || 'Unknown Indicator'}</Text>
</View>

/>
)}
<View className="ml-2 p-2 flex-1">
<Text className={mergeClassNames(typography.textSmMedium, "text-cnam-primary-950")}>Anxiété, Accablement, Contrariété, Jalousie,</Text>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded placeholder text should be replaced with dynamic data based on the actual patient state indicators.

Suggested change
<Text className={mergeClassNames(typography.textSmMedium, "text-cnam-primary-950")}>Anxiété, Accablement, Contrariété, Jalousie,</Text>
<Text className={mergeClassNames(typography.textSmMedium, "text-cnam-primary-950")}>
{patientStateRecordKeys.map(key => {
const indicator = indicateurs.find(i => i.genericUuid === key) || indicateurs.find(i => i.uuid === key);
return indicator?.name;
}).filter(Boolean).join(', ')}
</Text>

Copy link
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces a new status item design with modern styling. While the overall structure is good, there are several critical issues that need attention: a logic error in date display, dead code that should be removed, and potential rendering issues from removing the noData check. The TypeScript migration is incomplete, and there are some architectural concerns with the large component size.

) : (
<TouchableOpacity style={styles.item} onPress={() => navigation.navigate("too-late", { date })}>
<View className="bg-red">
{!canEdit(date) && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition appears to be inverted. Currently, the date container is only shown when canEdit(date) returns false, which seems backward. The date should typically be shown for all entries, or only for editable ones.

Suggested change
{!canEdit(date) && (
{canEdit(date) && (

};

const newItemCard = ({ emotionValue, handlePressItem }: { emotionValue: number; handlePressItem: any }) => {
<TouchableOpacity className="rounded-2xl border border-gray-500 flex-col my-4 p-6" onPress={() => handlePressItem({ editingSurvey: true })}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is defined but never used, creating dead code. It should be removed to keep the codebase clean.

<View style={styles.buttonsContainer}>
<Button icon="pencil" visible={true} onPress={() => handlePressItem({ editingSurvey: true })} />
</View>
) : null} */}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large commented code blocks should be removed rather than left in the codebase. This improves readability and reduces maintenance overhead.

title={canEdit(date) ? "Renseigner mon état pour ce jour-là" : "Je ne peux plus saisir mon questionnaire pour ce jour"}
image={{ source: require("./../../../assets/imgs/indicateur.png") }}
onPress={handlePressItem}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another large commented code block should be removed to keep the codebase clean.

<Text style={styles.dateLabel}>{formatDateThread(date)}</Text>
) : (
<TouchableOpacity style={styles.item} onPress={() => navigation.navigate("too-late", { date })}>
<View className="bg-red">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This debug className 'bg-red' should be removed before production deployment.

Suggested change
<View className="bg-red">
<View>

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
29.6% Duplication on New Code (required ≤ 15%)

See analysis details on SonarQube Cloud

@LucasCharrier LucasCharrier merged commit b988f5f into master Sep 23, 2025
5 of 8 checks passed
@LucasCharrier LucasCharrier deleted the task/new-status-item branch September 23, 2025 14:20
tokenbureau bot pushed a commit that referenced this pull request Sep 23, 2025
# [1.82.0](v1.81.0...v1.82.0) (2025-09-23)

### Features

* **status-item:** integrate new status-item design ([#444](#444)) ([b988f5f](b988f5f))
@tokenbureau
Copy link

tokenbureau bot commented Sep 23, 2025

🎉 This PR is included in version 1.82.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@tokenbureau tokenbureau bot added the released label Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants